From dd713e0ae2e2728df96548ddd20de65261f9c085 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Mon, 15 May 2017 15:01:29 +0200 Subject: [PATCH] widget: Consider css margins when setting clip This is optional for positive margins as they just increase the widget allocation. However, with negative css margins, the allocation is smaller than the clip. This fixes scale sliders leaving a small trail behind. --- gtk/gtkwidget.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 43c8b0c932..f45a3989dc 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -13447,6 +13447,7 @@ gtk_widget_set_clip (GtkWidget *widget, GtkWidgetPrivate *priv; GtkBorder shadow; GtkAllocation allocation; + GtkBorder margin; GtkCssStyle *style; g_return_if_fail (GTK_IS_WIDGET (widget)); @@ -13480,13 +13481,14 @@ gtk_widget_set_clip (GtkWidget *widget, /* Always untion the given clip with the widget allocation */ /* ... and with the box shadow size */ - allocation = priv->allocation; style = gtk_css_node_get_style (priv->cssnode); + allocation = priv->allocation; + get_box_margin (style, &margin); _gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow); - allocation.x -= shadow.left; - allocation.y -= shadow.top; - allocation.width += shadow.left + shadow.right; - allocation.height += shadow.top + shadow.bottom; + allocation.x += margin.left - shadow.left; + allocation.y += margin.top - shadow.top; + allocation.width += shadow.left + shadow.right - margin.left - margin.right; + allocation.height += shadow.top + shadow.bottom - margin.top - margin.bottom; gdk_rectangle_union (&allocation, clip, &priv->clip); } -- 2.30.2